<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2018/8/28
  Time: 16:46
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="s" uri="/struts-tags" %>
<html>
<head>
    <title>智能搜索房屋列表</title>
    <link rel="stylesheet" href="dist/css/bootstrap-3.3.7.mini.css">
    <script type="text/javascript" src="dist/js/jquery/jquery-2.1.1.min.js"></script>
    <script type="text/javascript" src="dist/js/bootstrap-3.3.7.min.js"></script>

    <style type="text/css">
        /**{
            border: solid;
        }*/

        #id-div-form-searchHouse{
            border-style: solid;
            width: 100%;
            padding: 50px 10%;
        }

    </style>

</head>
<body>
<hr>
<div id="id-div-form-searchHouse">
    <form action="house_searchHouseByConditions" method="post" class="form-inline" role="form">
        <%--<div class="form-group">
            <label class="sr-only" for="name">名称</label>
            <input type="text" class="form-control" id="name" placeholder="请输入名称">
        </div>--%>
        <hr>
        <div class="form-group">
            <button type="submit" class="btn btn-default">搜索</button>
            <input type="text" class="form-control" id="htitle" placeholder="请输入标题">
        </div><hr>
        <div class="form-group">
            <label  class="form-control">价格(元<sub>月)</sub></label>
            <select name="hprice" class="form-control">
                <option value="0-300">0-300</option>
                <option value="300-500">300-500</option>
                <option value="500-800">500-800</option>
            </select>
        </div><hr>
        <div class="form-group">
            <label  class="form-control">面积/m<sup>2</sup></label>
            <select name="hfloorage" class="form-control">
                <option value="0-100">0-100</option>
                <option value="100-120">100-120</option>
                <option value="140-800">140-800</option>
            </select>
        </div><hr>
        <div class="form-group">
            <label  class="form-control">户型</label>
            <select name="type_tid" class="form-control">
                <option value="1">==一室一厅</option>
                <option value="2">==二室一厅</option>
                <option value="3">==三室一厅</option>
            </select>
        </div><hr>
        <div class="form-group" >
            <label  class="form-control">区县</label>
            <select name="district_did" class="form-control">
                <option value="1">==东城区</option>
                <option value="2">==西城区</option>
                <option value="3">==南城区</option>
            </select>
        </div><hr>
        <div class="form-group">
            <label  class="form-control">街道</label>
            <select name="street_sid" class="form-control">
                <option value="1">==1东城区1莲花街</option>
                <option value="2">==2西城区2金水路</option>
                <option value="3">==3南城区3东风路</option>
            </select>
        </div><hr>
    </form>
</div>
<hr>
<div id="id-div-houseList">
    <table class="table table-hover">
        <caption class="form-control">房屋信息列表1</caption>
        <thead>
        <tr>
            <th>Id</th>
            <th>标题</th>
            <th>价格</th>
            <th>房屋面积</th>
            <th>房产证</th>
            <th>联系方式</th>
            <th>具体信息</th>
            <th>业主</th>
            <th>房屋类型</th>
            <th>区县</th>
            <th>街道</th>
        </tr>
        </thead>
        <tbody>
        <tr>
            <td>Tanmay</td>
            <td>Bangalore</td>
            <td>560001</td>
        </tr>
        <tr>
            <td>Sachin</td>
            <td>Mumbai</td>
            <td>400003</td>
        </tr>
        <tr>
            <td>Uma</td>
            <td>Pune</td>
            <td>411027</td>
        </tr>
        </tbody>
    </table>

</div>
<hr>


</body>
</html>
<script type="text/javascript">
    console.log("aaa");

    $(function () {
        console.log("bbb");
    })

    /*1:房屋列表*/
    searchHouseByConditions();
    function searchHouseByConditions(){
        console.log("111调用searchHouseByConditions函数");
        $.ajax({
            type:"post",
            url:"house_searchHouseByConditions",
            data:{
                htitle:"租",
                hprice:"300",
                type_tid:1,

                totalRecords:'30',
                maxRows:30,
                currPageNo:1,
            },
            dataType:"json",
            success:function (data) {
                /*console.log(data);*/
                var str="";
                $.each(data,function (index,obj) {
                    str+="<tr>";
                    str+="<td>"+obj.hid+"</td>";
                    str+="<td>"+obj.htitle+"</td>";
                    str+="<td>"+obj.hprice+"</td>";
                    str+="<td>"+obj.hfloorage+"</td>";
                    str+="<td>"+obj.hpubdate+"</td>";
                    str+="<td>"+obj.hcontact+"</td>";
                    str+="<td>"+obj.hdesc+"</td>";
                    str+="<td>"+obj.member.mid+obj.member.mname+"</td>";
                    str+="<td>"+obj.type.tid+obj.type.tname+"</td>";
                    str+="<td>"+obj.street.sid+obj.street.sname+"</td>";
                    str+="<td>"+obj.street.sid+obj.street.sname+"===="+obj.street.district.did+obj.street.district.dname+"</td>";
                    str+="</tr>";

                    $("#id-div-houseList table tbody").empty();
                    $("#id-div-houseList table tbody").append(str);
                });
                /*console.log(str);*/
                /*console.log($("#id-div-houseList table tbody").html());*/
            }
        });
    }

    /*2:户型的ajax加载*/
   /* select2Type();
    function select2Type() {
        console.log("222调用select2Type函数");
        $.ajax({
            type:"post",
            url:"type_searchType",
            data:{

            },
            dataType:"json",
            success:function (data) {
                /!*console.log("222===data");
                console.log(data);*!/
                var str="";
                $.each(data,function (index,obj) {
                    str+="<option value="+obj.tid+">"+obj.tid+obj.tname+"</option>";
                });
                $("select[name=type_tid]").empty();
                $("select[name=type_tid]").append(str);
            }
        });
    }*/

    /*3:区县的ajax加载*/
/*    select2District();
    function select2District() {
        console.log("333调用select2District函数");
        $.ajax({
            type:"post",
            url:"district_searchDistrict",
            data:{

            },
            dataType:"json",
            success:function (data) {
                console.log("333===data");
                console.log(data);
                var str="";
                $.each(data,function (index,obj) {
                    str+="<option value="+obj.did+">"+obj.did+obj.dname+"</option>";
                });
                $("select[name=district_did]").empty();
                $("select[name=district_did]").append(str);
            }
        });
    }*/
    /*s4:区县对应的街道集合的ajax加载*/
    /*select2Street();
    function select2Street() {
        console.log("444调用select2Street函数");
        $.ajax({
            type:"post",
            url:"street_searchStreet",
            data:{
                sdid:2
            },
            dataType:"json",
            success:function (data) {
                console.log("444===data");
                console.log(data);
                var str="";
                $.each(data,function (index,obj) {
                    str+="<option value="+obj.sid+">"+obj.sid+obj.sname+"</option>";
                });
                $("select[name=district_did]").empty();
                $("select[name=district_did]").append(str);
            }
        });
    }*/





</script>
